home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / medit.zip / EDITOR.DOC < prev    next >
Text File  |  1994-08-25  |  33KB  |  977 lines

  1.                    Magma Editor DLL for Microsoft Windows
  2.                    --------------------------------------
  3.  
  4. (C) Copyright 1994 Magma Systems  All Rights Reserved
  5.  
  6. Magma Systems
  7. 15 Bodwell Terrace
  8. Millburn, New Jersey  07041
  9. USA
  10.  
  11. (201) 912-0192  (voice)
  12. (201) 912-0103  (fax)
  13. (201) 912-0668  (BBS, 9600-1200 N-8-1)
  14.  
  15. Compuserve : 75300,2062
  16.              To get to our conference, GO MAGMA
  17.  
  18. Bix        : 'magma'
  19.              To get to our conference, 'join magma'
  20.  
  21. Internet   : 75300.2062@compuserve.com
  22.              magma@bix.com
  23.  
  24.  
  25.  
  26. (The following is rough documentation for the Magma Editor DLL. 
  27. Please send all your comments to Magma Systems)
  28.  
  29.  
  30. Introduction
  31. ------------
  32.  
  33. The Magma Editor DLL is an edit control which provides a powerful
  34. alternative to the standard Microsoft Windows edit control. The
  35. Magma Editor (ME for short) is a line oriented text editing kernel
  36. which can be controlled by an application through a series of
  37. messages or through a high-level C-like macro language. You can
  38. think of the ME DLL as being a "BRIEF in a box".
  39.  
  40. The editor kernel provides the following features and enhancements
  41. over the standard Windows editoc control :
  42.  
  43. - The size of the text is limited by the amount of memory Windows
  44.   can globally allocate. On the other hand, the standard Windows
  45.   edit control is limited to 64K of text.
  46.  
  47. - Regular expression search and substitution
  48.  
  49. - Various block operations. Line marking, column marking, block
  50.   marking, and discontiguous line marking.
  51.  
  52. - Keyboard macros
  53.  
  54. - Messages to read and write to files.
  55.  
  56. - More varieties of cursor movement. Ability to jump to a specific line,
  57.   and to set bookmarks in the text.
  58.  
  59. - The ability to be in overstrike as well as in insert mode.
  60.  
  61.  
  62. Initializing the Editor Class
  63. -----------------------------
  64.  
  65. To access the Magma Edit Control dynamic link library from within your
  66. Windows application, you must make the following call :
  67.  
  68.   if (LoadLibrary("MAGMAED.DLL") < 32)
  69.     return FALSE;
  70.  
  71. The LoadLibrary() function attempts to load the editor DLL, and if it
  72. succeeds, returns a module handle which is greater than or equal to 32.
  73. If a value less than 32 is returned, then the editor DLL could not be loaded.
  74.  
  75. You must make sure that the DLL is either present in your current
  76. working directory, or in a directory which is in your DOS path.
  77.  
  78. The startup routine inside of MAGMAED.DLL registers a global class 
  79. called "MagmaEdit". This is the class name of an editor control.
  80.  
  81.  
  82.  
  83. Creating an Editor Window
  84. -------------------------
  85. Creating an editor window is just like creating any other control window.
  86. You can use a call to the CreateWindow function or, if you use the
  87. editor window as part of a dialog box, you can specify the control
  88. in your RC file.
  89.  
  90. A typical use of the CreateWindow function is as follows:
  91.  
  92. HWND hEdit;
  93. hEdit = CreateWindow("MagmaEdit",
  94.                      NULL,
  95.                      WS_CHILD | WS_VISIBLE | WS_MAXIMIZE,
  96.                      0, 0, 0, 0,
  97.                      hWnd,
  98.                      idCtrl,
  99.                      GetWindowWord(hWnd, GWW_HINSTANCE),
  100.                      (LPSTR) lpFileName);
  101.  
  102. The classname is "MagmaEdit", and it has no initial text. The window
  103. style dictates that it is a visible child window, with 'hWnd' as the parent
  104. window. You may give the editor window a unique control identifier in
  105. order to distinguish it from other controls or editor windows. The size
  106. is 0, 0, 0, 0. Finally, the final argument may be the name of the
  107. file which will be associated with this editor window. If the file already 
  108. exists, then the contents of the file will be read into the editor window.
  109.  
  110.  
  111. Edit Styles
  112. -----------
  113.  
  114. The Magma Editor DLL supports some of the style bits which are associated
  115. with the normal Windows multiline edit control. 
  116.  
  117. In additon to the standard style, the editor supports the following
  118. style bits.
  119.  
  120. ES_WANTTAB
  121.   This is used when an edit control is part of a dialog box. The editor
  122.   examines this style when it processes the WM_GETDLGCODE message in
  123.   order to let the Windows dialog manager know whether it want to keep
  124.   the tabs.
  125.  
  126. ES_OWNERDRAW
  127.   Used to allow the application to render a line of the edit control.
  128.   See the ES_HASSTRINGS style.
  129.  
  130. ES_HASSTRINGS
  131.   Tells the edit control that there is a string of text associated with
  132.   every owner-drawn line in the buffer.
  133.  
  134.  
  135.  
  136. Limitations
  137. -----------
  138.  
  139. The Magma Edit control has no size limitations. It can use as much memory
  140. as Windows will globally allocate. The standard Windows edit control can only
  141. use at most 64K of data because it uses LocalAlloc for the edit buffer.
  142.  
  143.  
  144. Implementation of owner-drawn lines
  145. -----------------------------------
  146.  
  147. To test out owner-drawn controls, use the MEWIN demo which comes with the
  148. editor. If you start MEWIN with the -o argument, then it will make the edit
  149. buffer an owner-drawn buffer. (ie : win mewin -o foo.c). When you give the
  150. -o argument to MEWIN, it creates edit buffers with the style ES_OWNERDRAW |
  151. ES_HASSTRINGS. In this sample, MEWIN performs some syntax coloring. It
  152. searches for several reserved words in the C/C++ language and draws these
  153. words in a different color and with a bold-faced font. 
  154.  
  155. When a buffer is owner-drawn, several messages are sent to the parent of
  156. the edit control. 
  157.  
  158. The WM_MEASUREITEM message is sent to the parent window in order to allow
  159. your application to determine the height of a newly inserted line. See the
  160. Windows API documentation on the WM_MEASUREITEM message and the correspond-
  161. ing MEASUREITEMSTRUCT data structure. The only difference is that the con-
  162. stant ODT_EDIT is put into the CtlType field of the MEASUREITEMSTRUCT. 
  163.  
  164. If you process the WM_MEASUREITEM message, then you must do two things.
  165. First, you must put a valid value into the itemHeight field of the
  166. MEASUREITEMSTRUCT structure which is passed. Second, you must return the
  167. value TRUE from the parent's window procedure. If you return FALSE, then
  168. the edit control assigned the default height to the line (the default
  169. height is the height of the edit buffer's font). 
  170.  
  171. When a line is deleted from the edit control, a WM_DELETEITEM message is
  172. sent to the parent window. See the Windows API documentation on the
  173. WM_DELETEITEM message and the corresponding DELETEITEMSTRUCT data struc-
  174. ture. The only difference is that the constant ODT_EDIT is put into the
  175. CtlType field of the DELETEITEMSTRUCT. 
  176.  
  177. The most important message is the WM_DRAWITEM message. Again, please see
  178. the Windows API documentation on this message. There is one important point
  179. here which you must keep in mind. Instead of sending a DRAWITEMSTRUCT
  180. structure, the Magma Edit DLL sends a MEDRAWITEMSTRUCT structure. This new
  181. structure contains some addition fields in it which the DRAWITEMSTRUCT does
  182. not have. In particular, it contains the 'lpText' field, which points to
  183. the actual string which should be drawn. The definition of the
  184. MEDRAWITEMSTRUCT structure is contained in MAGMAED.H. 
  185.  
  186. If your application draws the line, it must return TRUE in response to the
  187. WM_DRAWITEM message. Otherwise, if you return FALSE, then the edit control
  188. draws the line on its own. 
  189.  
  190. To get a feel for how to proces the WM_DRAWITEM message, please see the
  191. file UIOWNDRW.C which comes with the MEWIN sample source code. 
  192.  
  193. There are several other messages which are associated with the Magma Edit
  194. control, and these messages let you query and set the various components of
  195. a line's owner-draw information. These messages are : 
  196.  
  197. ME_GETITEMDATA
  198. ME_SETITEMDATA
  199. ME_GETITEMHEIGHT
  200. ME_SETITEMHEIGHT
  201.  
  202.  
  203.  
  204.                       Message Reference
  205.                       -----------------
  206.  
  207. Below is a list of messages which you can send to an editor window
  208. in order to perform editing operations, cursor movement, or
  209. configuration of the editor. The general form of sending a
  210. message is
  211.  
  212.   result = SendMessage(hWndEdit, ME_xxx, wParam, lParam);
  213.  
  214. Most of the editor commands return TRUE if the command was performed
  215. successfully, and FALSE if the command failed.
  216.  
  217.  
  218. Cursor Movement commands
  219. ------------------------
  220. ME_MOVEUP             Move to the previous line
  221. ME_MOVEDOWN           Move to the next line
  222. ME_MOVELEFT           Move left one character
  223. ME_MOVERIGHT          Move right one character
  224. ME_MOVEBOL            Move to the beginning of the current line
  225. ME_MOVEEOL            Move to the end of the current line
  226. ME_MOVENEXTWORD       Move to the next word
  227. ME_MOVEPREVWORD       Move to the previous word
  228. ME_MOVENEXTPARA       Move to the next paragraph
  229. ME_MOVEPREVPARA       Move to the previous paragraph
  230. ME_MOVETOPOFWINDOW    Move to the upper-left corner of the editing window
  231. ME_MOVEBOTOFWINDOW    Move to the lower-right corner of the editing window
  232. ME_MOVENEXTPAGE       Move to the next page of text
  233. ME_MOVEPREVPAGE       Move to the previous page of text
  234. ME_MOVETOPOFBUFFER    Move to the top of the editing buffer
  235. ME_MOVEBOTOFBUFFER    Move to the last character in the editing buffer
  236. For all of the above commands, wParam and lParam are not used. The
  237. value TRUE is returned if the command was successful, and FALSE is
  238. returned if the command failed.
  239.  
  240. ME_GOTOLINE
  241.   wParam
  242.     GOTOLINE_ABS  - lParam is the absolute line number
  243.     GOTOLINE_NEXT - lParam is the # of lines from the current line
  244.     GOTOLINE_PREV - lParam is the # of lines back from the current line
  245.     GOTOLINE_LAST - go to the last line of the file. lParam is ignored.
  246.   lParam is the line number
  247.  
  248. ME_MATCHBRACE
  249. If the character at the current position is one of the following :
  250.   {, }, (, ), [, ], "
  251. attempts to find the matching brace or quote. If the match is found,
  252. the current position will be moved to the matched character.
  253.   Returns TRUE if successful, FALSE if not.
  254.  
  255.  
  256. Bookmarks
  257. ---------
  258. ME_MOVETOBOOKMARK
  259.   Moves the cursor to a specific bookmarked location.
  260. Parameters
  261.   wParam is the letter of the bookmark
  262.   lParam is not used
  263.  
  264. ME_SETBOOKMARK
  265.   Sets a bookmark at the current cursor position.
  266. Parameters
  267.   wParam is the letter of the bookmark to set
  268.   lParam is not used
  269.  
  270. ME_REMOVEBOOKMARK
  271.   Removes one or more bookmarks from the editing buffer.
  272. Parameters
  273.   wParam is the letter of the bookmark. It can be 'a' through 'z'. If
  274.     wParam is the special value BOOKMARK_REMOVEALL, then all of the
  275.     bookmarks associated with the editing buffer will be removed.
  276.   lParam is not used
  277. Returns
  278.   TRUE
  279.  
  280.  
  281.  
  282. Character Insertion & Deletion
  283. ------------------------------
  284. ME_BACKSPACE
  285.   Backspaces over the previous character and erases it
  286. Parameters
  287.   wParam is not used
  288.   lParam is not used
  289.  
  290. ME_DELCHAR
  291.   Delete the character at the current position. If the character is a newline,
  292.   the the next line will be joined to the current line.
  293. Parameters
  294.   wParam is not used
  295.   lParam is not used
  296.  
  297. ME_DELEOL
  298.   Deletes all characters from the current line starting at the 
  299.   current position and going until the end of the line
  300. Parameters
  301.   wParam is not used
  302.   lParam is not used
  303.  
  304. ME_DELWORD
  305.   Deletes the current word.
  306. Parameters
  307.   wParam is not used
  308.   lParam is not used
  309.  
  310. ME_INSERTCHAR
  311.   Inserts a character at the current position. This function
  312.   obeys the state of the editor's insert/overstrike mode.
  313. Parameters
  314.   wParam is the ASCII character to insert at the current position
  315.   lParam is not used
  316.  
  317.  
  318. ME_INSERTSTRING
  319.   Inserts a string into the editor at the current position.
  320. Parameters
  321.   wParam is ME_OVERSTRIKE_MODE if you want to overstrike the existing
  322.     text at the current position in the buffer. Any other value of 
  323.     wParam will insert the text at the current position in the buffer.
  324.   lParam is a far pointer to the text to insert. The text may have
  325.     embedded tab characters (\t) or newlines (\n).
  326. Returns
  327.   TRUE if the text was inserted, FALSE if not.
  328. Example
  329.   SendMessage(hWndEdit, ME_INSERTSTRING, ME_INSERT_MODE,
  330.               (LONG) (LPSTR) "This is line 1\nAnd this is line 2\n");
  331.  
  332.  
  333. ME_TOGGLEINSERT
  334.   Toggles or sets the state of the insert/overstrike mode
  335. Parameters
  336.   wParam can be
  337.     INSERTMODE_TOGGLE - toggle the state
  338.     INSERTMODE_ON     - sets insert mode
  339.     INSERTMODE_OFF    - sets overstrike mode
  340.   lParam is not used
  341.  
  342. ME_TOGGLEWORDWRAP
  343.   Toggles the current state of the wordwrap flag.
  344. Parameters
  345.   wParam can be
  346.     WORDWRAP_OFF      - turns wordwrap off
  347.     WORDWRAP_ON       - turns wordwrap on
  348.     WORDWRAP_TOGGLE   - toggles wordwrap mode
  349.   lParam is not used.
  350. Returns
  351.   Nothing.
  352.  
  353.  
  354. File I/O
  355. --------
  356. ME_OPENFILE
  357.   Inserts the contents of a file at the current cursor position.
  358. Parameters
  359.   wParam is 0 if lParam points to a valid filename. You can pass
  360.     the handle of an open file in wParam. If you do this, then lParam
  361.     must be 0.
  362.   lParam is a far pointer to the name of the file to read. If lParam
  363.     is 0, then wParam is assumed to contain the handle of an open file.
  364. Returns
  365.   TRUE if successful, FALSE if not.
  366.  
  367. ME_WRITEFILE
  368.   Writes the contents of the editor buffer to a file.
  369. Parameters
  370.   wParam is usually 0. If lParam is NULL, wParam may contain a
  371.     file handle.
  372.   lParam is a far pointer to the name of the file to write to.
  373.   If the lParam is NULL and wParam is 0, then the filename already associated 
  374.   with  the editor window is used. If lParam is NULL and wParam is not zero,
  375.   then wParam is interpeted as a file handle to write to.
  376. Returns
  377.   TRUE if successful, an error code if not. The error code can be
  378.   one of the following values :
  379.     EN_ERRCREATING  could not create the file
  380.     EN_ERRWRITING   could not write out the entire editor buffer to
  381.                     the file.
  382.  
  383.   
  384.  
  385. Search & Substitute commands
  386. ----------------------------
  387. ME_FSEARCH
  388.   Search forward (from the current position) for a pattern.
  389.  
  390. ME_BSEARCH
  391.   Search backwards (from the current position) for a pattern.
  392.  
  393. ME_FREPLACE
  394.   Search forward (from the current position) for a pattern and substitute 
  395.   with a pattern.
  396.  
  397. ME_BREPLACE
  398.   Search backward (from the current position) for a pattern and substitute
  399.   with a pattern.
  400.  
  401. Parameters
  402.   wParam is not used
  403.   lParam :
  404.  
  405.   For the search and substitute commands, the format of the data passed
  406.   into lParam is :
  407.  
  408.   UINT fFlags;
  409.     SEARCH_CASE_INSENSITIVE    - the search is case insensitive
  410.     SEARCH_NO_REGEXP           - the pattern is not considered to be
  411.                                  a regular expression
  412.     SEARCH_PROMPT_ON_REPLACE   - prompts the user for each replacement
  413.     SEARCH_SELECTMATCH         - the matched text is highlighted and selected
  414.  
  415.   char szPattern[];    the ASCII search pattern, NULL terminated
  416.   char szReplace[];    the ASCII replacement pattern, NULL terminated
  417.  
  418.   The SEARCH_PROMPT_ON_REPLACE flag and szReplace[] string are only valid
  419.   in the Substitute command
  420.  
  421.   If lParam is NULL, then the editor will automatically bring up dialog
  422.   boxes for the search and substitute commands. This will allow you to
  423.   interactively enter the search and replace strings and the various
  424.   options.
  425.  
  426. Returns
  427.   TRUE if the pattern was found, FALSE if not.
  428.  
  429.  
  430. ME_SEARCHAGAIN     
  431.   Repeats the previous search operation.
  432. Parameters
  433.   wParam and lParam are not used
  434.  
  435. ME_REPLACEAGAIN
  436.   Repeats the previous replace operation.
  437. Parameters
  438.   wParam and lParam are not used
  439.  
  440. Returns
  441.   TRUE if the pattern was found, FALSE if not.
  442.  
  443.  
  444. ME_QUERYSEARCHSTRING
  445.   Retrieves the last string used for searching.
  446. Parameters
  447.   wParam is not used
  448.   lParam is the far pointer to a buffer which the search string will be copied
  449.     to. lParam can be NULL.
  450. Returns
  451.   The length of the search string, or 0 or there was no previous search
  452.   string.
  453.  
  454.  
  455.  
  456. Help
  457. ----
  458. ME_HELPONWORD
  459.   Gets help on the word under the cursor. The Windows help file used is
  460.   the one which is in the APIHELP entry in [options] section of the
  461.   MAGMAED.INI file.
  462. Parameters
  463.   wParam and lParam are not used
  464. Returns
  465.   TRUE if successful, FALSE if not.
  466.  
  467.  
  468. Selecting, cutting, copying and pasting text
  469. --------------------------------------------
  470. ME_APPENDLINE
  471.   Appends a blank line after the current line
  472. Parameters
  473.   wParam and lParam are not used
  474.  
  475. ME_CASELOWER
  476.   Changes the case of the selected text to all lower case
  477. Parameters
  478.   wParam and lParam are not used
  479.  
  480. ME_CASEUPPER
  481.   Changes the case of the selected text to all upper case
  482. Parameters
  483.   wParam and lParam are not used
  484.  
  485. ME_COPY
  486.   Copies the current selection, any marked lines, or the current line.
  487.   The copied text is placed into the clipboard.
  488.   If there is a currently marked selection, then this text is copied.
  489.   If there is no selected text, then the current line is copied.
  490.   The clipboard is cleared before the copied text is placed into it.
  491. Parameters
  492.   wParam and lParam are not used
  493.  
  494. ME_CUT
  495.   Deletes the current selection, any marked lines, or the current line.
  496.   The deleted text is placed into the clipboard.
  497.   If there is a currently marked selection, then this text is deleted.
  498.   If there is no selected text, then the current line is deleted.
  499.   The clipboard is cleared before the deleted text is placed into it.
  500. Parameters
  501.   wParam and lParam are not used
  502.  
  503. ME_CUTAPPEND
  504.   Deletes the current selection, any marked lines, or the current line.
  505.   The deleted text is placed into the clipboard.
  506.   If there is a currently marked selection, then this text is deleted.
  507.   If there is no selected text, then the current line is deleted.
  508.   The selected text is appended to the clipboard.
  509. Parameters
  510.   wParam and lParam are not used
  511.  
  512. ME_DELLINE
  513.   Deletes the current line or any marked lines. The deleted lines are
  514.   not placed into the clipboard.
  515. Parameters
  516.   wParam and lParam are not used
  517.  
  518. ME_DUPLINE
  519.   Duplicates the current line and inserts it after the current line.
  520. Parameters
  521.   wParam and lParam are not used
  522.  
  523. ME_INSERTLINE
  524.   Inserts a blank line before the current line
  525. Parameters
  526.   wParam and lParam are not used
  527.  
  528. ME_MARKLINE
  529.   Toggles the marked state of the current line.
  530. Parameters
  531.   wParam and lParam are not used
  532.  
  533. ME_MARKLINERANGE
  534.   Marks all lines from the current line up to the previously marked line.
  535.   The previously marked line must physically above the curent line.
  536. Parameters
  537.   wParam and lParam are not used
  538.  
  539. ME_PASTE
  540.   Inserts the contents of the pick buffer at the current position
  541. Parameters
  542.   wParam and lParam are not used
  543.  
  544. ME_RECTMARK
  545.   Starts or ends a 'column' selection. If this message is sent when there
  546.   are no selected areas of text, then the editor will 'mark' the
  547.   current cursor position. You can then move the cursor anywhere in the
  548.   buffer. When the second ME_STREAMMARK message is received by the
  549.   editor, it will select the columns of text between the starting and ending
  550.   selection points.
  551. Parameters
  552.   wParam and lParam are not used
  553.  
  554. ME_RESETMARK
  555.   Clears all selections from the current buffer. If any text is selected,
  556.   then it will become deselected.
  557. Parameters
  558.   wParam and lParam are not used
  559.  
  560. ME_STREAMMARK
  561.   Starts or ends a 'stream' selection. If this message is sent when there
  562.   are no selected areas of text, then the editor will 'mark' the
  563.   current cursor position. You can then move the cursor anywhere in the
  564.   buffer. When the second ME_STREAMMARK message is received by the
  565.   editor, it will select all text between the starting and ending
  566.   selection points.
  567. Parameters
  568.   wParam and lParam are not used
  569.  
  570. ME_TAB
  571. ME_BACKTAB
  572.   Indents the selected lines rightwards or leftwards. The ME_TAB command
  573.   pushes the text rightwards, and the ME_BACKTAB command pushes the text
  574.   leftwards.
  575. Parameters
  576.   wParam and lParam are not used
  577.  
  578.  
  579. Undo
  580. ----
  581. ME_REDO
  582.   Undoes the previous undo.
  583. Parameters
  584.   wParam and lParam are not used
  585.  
  586. ME_UNDO
  587.   Undoes the previous editing command.
  588. Parameters
  589.   wParam and lParam are not used
  590.  
  591.  
  592. Configuring the editor
  593. ----------------------
  594. ME_OPTIONDLG
  595.   Invokes the "Options" dialog box. This provides an interactive
  596.   way for the user to configure the editor.
  597. Parameters
  598.   wParam and lParam are not used
  599.  
  600. ME_SETOPTION
  601.   Sets a specific editor option.
  602. Parameters
  603.   wParam is the new value
  604.   lParam is a far pointer to the name of the option
  605.  
  606.  
  607. Name          Default   Meaning
  608. -----------   -------   -------
  609. AutoIndent    1         Are new lines auto-indented
  610. EntabLine     0         Lines are entabbed when written to a file
  611. GoFreeSpace   1         Can the cursor move into space beyond the end-of-line
  612. HighBitsOff   0         Editor masks out the high bit of characters
  613. IndentAmount  2         The amount of space each indent/undent command shifts
  614. InsertMode    1         The initial insert/overstrike mode  (1 = insert)
  615. RightMargin   80        The margin where wordwrapping will take effect
  616. TabFill       32        The fill character used for tabs
  617. TabIncrement  8         The width of a tab stop
  618. UndoEnabled   1         Undo enabled
  619. UseRealTabs   0         Use real tabs or insert spaces instead of tabs
  620. Wordwrap      0         Wordwrap enabled
  621.  
  622. ME_QUERYOPTION
  623.   Queries the current value of a specific editor option.
  624. Parameters
  625.   wParam is not used.
  626.   lParam is a far pointer to the name of the option
  627. Returns
  628.   The current value of the editor option.
  629.  
  630.  
  631. ME_SETTEXTCOLOR
  632.   Sets the color of the text.
  633. Parameters
  634.   wParam not used
  635.   lParam is the RGB color
  636.  
  637. ME_SETBKCOLOR
  638.   Sets the color of the editor window background.
  639. Parameters
  640.   wParam not used
  641.   lParam is the RGB color
  642.  
  643. EM_SETBKGNDCOLOR  (Chicago compatible)
  644.   Sets the color of the editor window background.
  645. Parameters
  646.   wParam is TRUE to use system color, FALSE for RGB value in lParam
  647.   lParam is the RGB value
  648. Returns
  649.   The old background color
  650.  
  651.  
  652. Messages for Owner-Drawn Edit Controls
  653. --------------------------------------
  654.  
  655. ME_GETITEMDATA
  656.   Queries the item-data value of a line in the edit buffer. Each
  657.   line in an owner-drawn edit buffer can have a 4-byte value associated
  658.   with it. This value is passed in the 'itemData' field of the
  659.   MEASUREITEMSTRUCT, DELETEITEMSTRUCT, and MEDRAWITEMSTRUCT.
  660. Parameters
  661.   wParam is the 0-based line number. If lParam is not 0, then the
  662.     value in lParam is used as the line number.
  663.   lParam can be the 0-based line number.
  664. Returns
  665.   The application-defined 4-byte data value which is associated with a line.
  666.  
  667. ME_SETITEMDATA
  668.   Sets the item-data value of a line in the edit buffer. Each
  669.   line in an owner-drawn edit buffer can have a 4-byte value associated
  670.   with it. This value is passed in the 'itemData' field of the
  671.   MEASUREITEMSTRUCT, DELETEITEMSTRUCT, and MEDRAWITEMSTRUCT.
  672. Parameters
  673.   wParam is the 0-based line number.
  674.   lParam contains the 4-byte value which is associated with the line.
  675. Returns
  676.   TRUE if set, LB_ERR if not set.
  677.  
  678. ME_GETITEMHEIGHT
  679.   Queries the owner-drawn height of a line in the edit buffer.
  680. Parameters
  681.   wParam is the 0-based line number. If lParam is not 0, then the
  682.     value in lParam is used as the line number.
  683.   lParam can be the 0-based line number.
  684. Returns
  685.   The height of the line.
  686.  
  687. ME_SETITEMHEIGHT
  688.   Sets the owner-drawn height of a line in the edit buffer.
  689. Parameters
  690.   wParam is the 0-based line number.
  691.   lParam contains the pixel height of the line.
  692. Returns
  693.   TRUE if set, LB_ERR if not set.
  694.  
  695.  
  696. Miscellaneous commands
  697. ----------------------
  698. ME_GETCURRWORD
  699.   Retrieves the word under the cursor and puts it in an app-passed buffer.
  700. Parameters
  701.   wParam is the length of the buffer
  702.   lParam is a far pointer to the buffer to copy the word into
  703. Returns
  704.   The length of the string if successful, 0 if not.
  705.  
  706.  
  707. ME_QUERYSTATUS
  708.   This message retrieved certain information about the editing buffer.
  709.   Information includes the current column, current line number, and the
  710.   total number of lines in the buffer.
  711. Parameters
  712.   wParam is not used.
  713.   lParam is a far pointer to an MAGMAED_STATUS structure.
  714. Returns
  715.   TRUE if the infomation was retrieved, FALSE if not.
  716.  
  717. Keyboard Macros
  718. ---------------
  719. ME_KEYMACDEFINE
  720.   Starts and stops the recording of a keyboard macro. To begin recording
  721.   a keyboard macro, send the ME_KEYMACDEFINE message to the editor. To
  722.   stop the recording, send this message again.
  723. Parameters
  724.   wParam and lParam are not used
  725.  
  726. ME_KEYMACPLAY
  727.   Plays the currently-defined keyboard macro
  728. Parameters
  729.   wParam and lParam are not used
  730.  
  731.  
  732. Notification messages
  733. ---------------------
  734. MEN_UPDATE
  735.   This notification code is sent when the state of the editor has changed.
  736.   A WM_COMMAND message will be sent to the window which is the parent of
  737.   the editor window. The wParam will be the control ID of the editor
  738.   window, the LOWORD of the lParam will be the window handle of the
  739.   editor window, and the HIWORD of the lParam will be the MEN_UPDATE
  740.   code.
  741.  
  742.   A typical use for this message is to update the "editor decorations"
  743.   in your application when something in the editor has changed. For
  744.   example, if your application maintains a status line for the
  745.   editor, then you can use the following code in your application
  746.   in order to update the status line:
  747.  
  748.     case WM_COMMAND:
  749.       if (HIWORD(lParam) == MEN_UPDATE)
  750.       {
  751.         InvalidateRect(hWndStatus, (LPRECT) NULL, FALSE);
  752.         break;
  753.       }
  754.  
  755.  
  756. Windows/API Messages Supported
  757. ------------------------------
  758. The following messages are provided for compatibility with the
  759. standard Windows edit control.
  760.  
  761.  
  762. WM_GETTEXT
  763.   Retrieves the contents of the edit control and puts the text into the
  764.   passed memory location.
  765. Parameters
  766.   wParam is the maximum size of the text to be copied.
  767.   Note:
  768.     A limitation is that wParam contains the max length of the buffer,
  769.     which under 16-bit Windows, can be at most 64K. So, we will add
  770.     a little extension here. If wParam is 0, then we will not check
  771.     the length of the buffer.
  772.   lParam is a far pointer to the memory location which will receive the
  773.     text.
  774. Returns
  775.   The number of bytes copied into the memory location, or 0 if not
  776.   successful.
  777.  
  778. WM_GETTEXTLENGTH
  779.   Queries the length of the text in the edit control.
  780. Parameters
  781.   wParam and lParam are not used.
  782. Returns
  783.   The number of characters in the edit control. This double-word value
  784.   can be greater than 64K.
  785.  
  786. WM_SETTEXT
  787.   Sets the contents of the edit control to the specified text.
  788. Parameters
  789.   wParam is not used.
  790.   lParam is a far pointer to the text to set.
  791. Returns
  792.   TRUE if successful, FALSE if not.
  793.  
  794.  
  795. EM_GETFIRSTVISIBLELINE
  796.   Queries the line number of the line which is at the top of the
  797.   editor window.
  798. Parameters
  799.   wParam is not used.
  800.   lParam is not used.
  801. Returns
  802.   The 0-based line number of the line at the top of the window.
  803.  
  804. EM_GETLINE
  805.   Retrieves the contents of a specified line.
  806. Parameters
  807.   wParam is the 0-based line number of the line to query.
  808.   lParam is a far pointer to a memory location where the contents
  809.     of the line will be copied to.
  810. Returns
  811.   The number of bytes copied.
  812.  
  813. EM_GETLINECOUNT
  814.   Queries the number of lines in the edit control.
  815. Parameters
  816.   wParam is not used.
  817.   lParam is not used.
  818. Returns
  819.   The number of lines in the editor.
  820.  
  821. EM_GETSELTEXT  (Chicago compatible)
  822.   This message retrieves the text which is currently selected.
  823. Parameters
  824.   wParam is 0
  825.   lParam is a far pointer to a buffer which the text will be placed into.
  826. Returns
  827.   TRUE if there was selected text, FALSE if not.
  828. Notes
  829.   The editor does not check the length of the the buffer pointed to by
  830.   lParam. It is up to the application to ensure that the buffer is large
  831.   enough to hold the selected text.
  832.  
  833.  
  834. EM_LINEFROMCHAR
  835.   Given a 0-based index into the editor, returns the line number of
  836.   the line which contains the character.
  837. Parameters
  838.   wParam contains the 0-based index of the character.
  839.   Note :
  840.     A limitation is that wParam contains the max length of the buffer,
  841.     which under 16-bit Windows, can be at most 64K. So, we will add
  842.     a little extension here. If lParam is not 0, then we will use the
  843.     value in lParam as the index.
  844.   lParam must be 0 if you are using wParam as the index. Otherwise,
  845.     lParam will be used as the index.
  846. Returns
  847.   The 0-based line number.
  848.  
  849. EM_EXLINEFROMCHAR  (Chicago compatible)
  850.   See the EM_LINEFROMCHAR message.
  851. Parameters
  852.   wParam is 0
  853.   lParam is the index
  854.  
  855. EM_LINEINDEX
  856.   Given the number of a line, returns the 0-based index of the first
  857.   character on that line.
  858. Parameters
  859.   wParam is the 0-based line number. If lParam is not 0, then lParam is
  860.     used as the line number.
  861.   lParam should be 0 if you are using wParam to hold the line number.
  862.     Otherwise, lParam can hold the line number.
  863. Returns
  864.   The 0-based index of the first character on the line. If wParam contains
  865.   a line number which is greater than the number of lines in the edit
  866.   control, then -1 is returned.
  867.  
  868. EM_LINELENGTH
  869.   Queries the number of characters in a certain line.
  870. Parameters
  871.   wParam is the 0-based index of a character in the buffer. This index will
  872.     be used to detrmine the line to query. If lParam is not 0, then lParam
  873.     holds the character index.
  874.   lParam should be 0 if wParam holds the character index. Otherwise, the
  875.     value in lParam will be used as the character index.
  876. Returns
  877.   The number of characters in the line, or 0 if the line number
  878.   does not exist.
  879.  
  880. EM_GETMODIFY
  881.   Queries the modification state of the edit control.
  882. Parameters
  883.   wParam is not used.
  884.   lParam is not used.
  885. Returns
  886.   Non-zero if the edit control has been modified, 0 if not.
  887.  
  888. EM_SETMODIFY
  889.   Sets the modification state of the edit control.
  890. Parameters
  891.   wParam is the new modification state. It should be non-zero if the
  892.     edit control should be considered to have been modified, and zero
  893.     if you want to clear the modification state.
  894.   lParam is not used.
  895. Returns
  896.   The new modification state.
  897.  
  898. EM_GETSEL
  899.   Queries the current selection points.
  900. Parameters
  901.   wParam and lParam are not used.
  902. Returns
  903.   If an area of text has been selected, then the low word of the return
  904.   value is the starting index of the selection and the high word of
  905.   the return value is the index of the last selected character plus 1.
  906.   If an area is not selected, then both the low word and high word of the
  907.   return value contain the index where the cursor is currently positioned.
  908.  
  909. EM_REPLACESEL
  910.   Replaces the selected text with another string.
  911. Parameters
  912.   wParam is not used.
  913.   lParam is a far pointer to a string to use to replace the selected text
  914.   with.  
  915.  
  916. EM_SETSEL
  917.   Sets the current selection points. Each selection point must be an index
  918.   less than 64K. See the EM_EXSETSEL message if you need to select an
  919.   area in a buffer which contains more than 64K of text.
  920. Parameters
  921.   wParam is 0.
  922.   The low word of lParam is the index of the starting point of the
  923.   selected area. The high word of lParam is the index of the first
  924.   character after the starting selection index which is not selected.
  925.  
  926.  
  927. EM_EXGETSEL  (Chicago compatible)
  928.   Queries the current selection points. Each selection point can be
  929.   a number greater than 64K.
  930. Parameters
  931.   wParam is 0
  932.   lParam is a far pointer to a CHARRANGE structure
  933.  
  934. EM_EXSETSEL  (Chicago compatible)
  935.   Sets the current selection points. Each selection point can be
  936.   a number greater than 64K.
  937. Parameters
  938.   wParam is 0
  939.   lParam is a far pointer to a CHARRANGE structure
  940.  
  941.  
  942. EM_SETREADONLY
  943.   Modifies the 'read-only' state of the edit control.
  944. Parameters
  945.   wParam is non-zero if the read-only state should be set, and zero
  946.     if it should be cleared.
  947.   lParam is not used.
  948. Returns
  949.    TRUE if successful, FALSE if not.
  950.  
  951. EM_SETTABSTOPS
  952.   Sets the tab stops of the edit control.
  953. Parameters
  954.   wParam specifies the number of tab stops contained in the lpTabs array
  955.     pointed to by lParam. If wParam is 1, then the lpTabs[0] contains
  956.     tab increment multiplied by 4; the tabs will be set every
  957.     'lpTabs[0]/4' number of columns. If wParam is 0, then the default tab 
  958.     settings are used. If wParam is greater than 1, then lpTabs is an array 
  959.     of tab stops.
  960.  
  961.   lParam is a far pointer to an array of tab stops. Each tab stop
  962.     represents a column number multiplied by 4. The value 4 is equivalent
  963.     to the Windows dialog unit.
  964. Returns
  965.   TRUE if the tabs were set, FALSE if not.
  966.  
  967. Notification Messages
  968. ---------------------
  969. EN_CHANGE     the contents of the edit control have been altered
  970. EN_HSCROLL    the edit control's horizontal scrollbar has been clicked on
  971. EN_KILLFOCUS  the edit control is losing the focus
  972. EN_SETFOCUS   the edit control has gained the focus
  973. EN_VSCROLL    the edit control's horizontal scrollbar has been clicked on
  974. MEM_UPDATE    the editing status has changed. This message is usually
  975.               used to determine when the status line should be refreshed.
  976.  
  977.